package oo.shootgame;

import java.awt.image.BufferedImage;
import java.util.Random;
public class Boss extends Plane implements Emeny,Award{
	private int speed;
	private BufferedImage[] images;
	private int index;
	private int AwardType;
	public Boss(){
		image=ShootGame.Boss0;
		images=new BufferedImage[]{ShootGame.Boss0,ShootGame.Boss1};
		Random ran=new Random();
		width=image.getWidth();
		height=image.getHeight();
		life=50;
		x=ran.nextInt(ShootGame.WIDTH-width-50);
		y=ran.nextInt(250-height)+height;
		index=0;
		speed=1;
		AwardType=(int)(Math.random()*2+2);
	}
	public int getScore(){
		return 250;
	}
	public void step(){
		index++;
		if(index%50==0){
			image=images[0];
		}
		x+=speed;
		if(x>=(ShootGame.WIDTH-width)){
			speed=-1;
		}
		if(x<=0){
			speed=1;
		}
	}
	public Bullet[] BossShoot(){
		Bullet[] bos=new Bullet[3];
		bos[0]=new Bullet(x+width/2,y+height+10);
		bos[1]=new Bullet(x+width/2,y+height+10);
		bos[2]=new Bullet(x+width/2,y+height+10);
		return bos;
	}
	public void lifedown(){
		this.life--;
	}
	public int getType(){
		return AwardType;
	}


}
